﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.XZYData.Domain.ZSH
{
    /// <summary>
    /// 流程模版设计
    /// </summary>
    [Table("WorkflowDefinition")]
    public class WorkflowDefinitionModel
    {
        /// <summary>
        /// 主键，唯一标识
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }
        /// <summary>
        /// 流程标识
        /// </summary>
        [SugarColumn(Length = 100, IsNullable = false)]
        public string DefintionId { get; set; } = null!;
        /// <summary>
        /// 流程版本
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public int Version { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = false)]
        public string Title { get; set; } = null!;
        /// <summary>
        /// 审批步骤
        /// </summary>
        [SugarColumn(ColumnDataType = "text", IsNullable = false)]
        public string StepNodes { get; set; } = null!;
        /// <summary>
        /// 表单模版
        /// </summary>
        [SugarColumn(ColumnDataType = "text", IsNullable = true)]
        public string? FormTemplate { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 创建人ID（关联User.Id）
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public int CreatorId { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 最后修改人ID（关联User.Id）
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int? ModifierId { get; set; }

        /// <summary>
        /// 伪删除标记（false=未删除，true=已删除）
        /// </summary>
        [SugarColumn(IsNullable = false)]
        public bool IsDeleted { get; set; } = false;
    }
    /// <summary>
    /// 审批节点对象
    /// </summary>
    public class StepNode
    {
        /// <summary>
        /// 步骤id
        /// </summary>
        public string StepId { get; set; }
        /// <summary>
        /// 步骤名称
        /// </summary>
        public string StepName { get; set; }
        /// <summary>
        /// 当前步骤审批人id
        /// </summary>
        public long AuditUserId { get; set; }
        /// <summary>
        /// 当前步骤审批人名称
        /// </summary>
        public string AuditUserName { get; set; }
        /// <summary>
        /// 下一个审批步骤
        /// </summary>
        public string NextStepId { get; set; }
    }
    /// <summary>
    /// 表单模版对象
    /// </summary>
    public class FormTemplateNode
    {
        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { get; set; }
        /// <summary>
        /// 字段显示名
        /// </summary>
        public string DisplayFieldName { get; set; }
        /// <summary>
        /// 字段类型
        /// </summary>
        public string FieldTypeName { get; set; }
        /// <summary>
        /// 默认内容
        /// </summary>
        public string DataValue { get; set; }
    }
}
